﻿using DocumentFormat.OpenXml.Lite.DrawingML.Types;
using DocumentFormat.OpenXml.Lite.Shared;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.DrawingML.Chart
{
    [XmlRoot("layout", Namespace = Constants.Chart)]
    public class Layout : XmlSerializable
    {
        [Optional]
        [XmlElement("manualLayout", Namespace = Constants.Chart)]
        public ManualLayout ManualLayout { get; set; }

        [Optional]
        [XmlElement("extLst", Namespace = Constants.Chart)]
        public ExtensionList ExtensionList { get; set; }

        public Layout() { }
    }

    [XmlRoot("manualLayout", Namespace = Constants.Chart)]
    public class ManualLayout : XmlSerializable
    {
        [Optional]
        [XmlElement("layoutTarget", Namespace = Constants.Chart)]
        public NullableValue<ST_LayoutTarget> LayoutTarger { get; set; }

        [Optional]
        [XmlElement("xMode", Namespace = Constants.Chart)]
        public NullableValue<ST_LayoutMode> LeftMode { get; set; }

        [Optional]
        [XmlElement("yMode", Namespace = Constants.Chart)]
        public NullableValue<ST_LayoutMode> TopMode { get; set; }

        [Optional]
        [XmlElement("wMode", Namespace = Constants.Chart)]
        public NullableValue<ST_LayoutMode> WidthMode { get; set; }

        [Optional]
        [XmlElement("hMode", Namespace = Constants.Chart)]
        public NullableValue<ST_LayoutMode> HeightMode { get; set; }

        [Optional]
        [XmlElement("x", Namespace = Constants.Chart)]
        public NullableValue<double> Left { get; set; }

        [Optional]
        [XmlElement("y", Namespace = Constants.Chart)]
        public NullableValue<double> Top { get; set; }

        [Optional]
        [XmlElement("w", Namespace = Constants.Chart)]
        public NullableValue<double> Width { get; set; }

        [Optional]
        [XmlElement("h", Namespace = Constants.Chart)]
        public NullableValue<double> Height { get; set; }

        [Optional]
        [XmlElement("extLst", Namespace = Constants.Chart)]
        public ExtensionList ExtensionList { get; set; }

        public ManualLayout() { }
    }
}
